import request from '@/utils/request'
import { getToken } from "@/utils/auth";

// 查询分析报告列表
export function listAnalysis(query) {
  return request({
    url: '/oil/analysis/list',
    method: 'get',
    params: query
  })
}

// 查询分析报告详细
export function getAnalysis(id) {
  return request({
    url: '/oil/analysis/' + id,
    method: 'get'
  })
}

// 新增分析报告
export function addAnalysis(data) {
  return request({
    url: '/oil/analysis',
    method: 'post',
    data: data,
    timeout: 60000  // 设置超时时间为60秒（60000毫秒），可根据需要调整
  })
}

// 修改分析报告
export function updateAnalysis(data) {
  return request({
    url: '/oil/analysis',
    method: 'put',
    data: data
  })
}

// 删除分析报告
export function delAnalysis(id) {
  return request({
    url: '/oil/analysis/' + id,
    method: 'delete'
  })
}
// 下载分析报告
export function downAnalysis(id) {
  return request({
    url: '/oil/analysis/' + id,
    method: 'download'
  })
}

  // 上传文件
export function uploadBookFile(data) {
  return request({
    url: '/oil/analysis/uploadFile',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'multipart/form-data',
      'Authorization': "Bearer " + getToken(),
    }
  })
}